﻿// <com.woyouqiu.Copyright>
// --------------------------------------------------------------
// <copyright>上海有求网络科技有限公司 2015</copyright>
// <Solution>Vecen.BangChuang</Solution>
// <Project>Vecen.BangChuang.Core</Project>
// <FileName>AgentApplyEventHandler.cs</FileName>
// <CreateTime>2017-05-08 0:06</CreateTime>
// <Author>何苗</Author>
// <Email>hemiao@woyouqiu.com</Email>
// <log date="2017-05-08 0:06" version="00001">创建</log>
// --------------------------------------------------------------
// </com.woyouqiu.Copyright>

using Abp.Dependency;
using Abp.Events.Bus.Handlers;
using Abp.Threading;
using Vecen.BangChuang.BangChuang.DomainServices.Agents;
using Vecen.BangChuang.BangChuang.DomainServices.EventHandlers.EventDatas;

namespace Vecen.BangChuang.BangChuang.DomainServices.EventHandlers {
    public class AgentApplyEventHandler: IEventHandler<AgentApplyPassedEventData>, ITransientDependency {
        private readonly AgentDomainService _agentDomainService;

        public AgentApplyEventHandler(AgentDomainService agentDomainService) {
            _agentDomainService = agentDomainService;
        }

        public void HandleEvent(AgentApplyPassedEventData eventData) {
            AsyncHelper.RunSync(() => _agentDomainService.PromotionFromApplyAsync(eventData.ApplyId));
        }
    }
}